﻿using Dyao.Book.Contract;

namespace Dyao.Book.Application.Abstractions
{
    /// <summary>
    /// 任务中心请求参数序列化器
    /// </summary>
    public interface ITaskCenterRequestParamsSerializer
    {
        /// <summary>
        /// 序列化
        /// </summary>
        /// <param name="actionKey"></param>
        /// <param name="catetory"></param>
        /// <param name="requestParams"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<string> SerializeAsync(string actionKey, TaskCenterCategoryEnum catetory, object requestParams, CancellationToken cancellationToken = default);

        /// <summary>
        /// 反序列化
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="taskId"></param>
        /// <param name="actionKey"></param>
        /// <param name="catetory"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<T> DeserializeAsync<T>(int taskId, string actionKey, TaskCenterCategoryEnum catetory, CancellationToken cancellationToken = default);
    }
}
